package com.laoluo.erp.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.laoluo.erp.dao.UserDAO;
import com.laoluo.erp.domain.User;
import com.laoluo.erp.service.UserService;
import com.laoluo.erp.util.PageListData;

@Service
public class UserServiceImpl implements UserService {

	private UserDAO dao;
	
	@Resource(name="userDAOImpl")
	public void setDao(UserDAO dao){
		this.dao = dao;
	}
	
	public void save(User user) {
		dao.save(user);
	}

	public void delete(User user) {
		dao.delete(user);
	}

	public void delete(Integer id) {
		dao.delete(User.class,id);
	}

	public void update(User user) {
		dao.update(user);
	}

	public User findById(Integer id) {
		return dao.findById(User.class, id);
	}

	public List<User> findAll() {
		return dao.findAll(User.class);
	}
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public PageListData queryPage(Map param, int start, int limit,int page)
	{
		param.put("start", start);
		param.put("limit", limit);
		return dao.queryPage(User.class, param, start,limit,page);
	}
}
